#include <myheader_c_plus.h>
using std::cout;
using std::endl;
using std::cin;
using std::ostream;
using std::string;
using std::istream;
using std::istringstream;
//begin of the line
class Line{
public:
    Line(int x1, int y1, int x2, int y2)
    :_pt1(x1, y1)
    ,_pt2(x2, y2)
    {

    }
    
friend ostream & operator<<(ostream & os, const Line & rhs);
friend istream & operator>>(istream & is,  Line & rhs);

    //begin of Point
    class Point {
    public:
        Point (int x, int y)
        :_x(x)
        ,_y(y)
        {

        }

        void print(){
            cout << "(" << _x <<"," << _y << ")" << endl;
        }
        friend ostream & operator<<(ostream & os, const Line::Point & rhs);
        friend istream & operator>>(istream & is,  Line::Point & rhs);
    


    private:
        int _x;
        int _y;



    };//end of Point

private:
    Point _pt1;
    Point _pt2;
};//end of the line

ostream & operator<<(ostream & os, const Line & rhs){
    os << rhs._pt1 << "---->" <<rhs._pt2 ;
    return os;

}

ostream & operator<<(ostream & os, const Line::Point & rhs){
    os << "(" << rhs._x << "," << rhs._y << ")";
    return os;
}

istream & operator>>(istream & is, Line & rhs){
    cout << "请输入(x1,y1)" << endl;
    is >> rhs._pt1;
    cout << "请输入(x2,y2)" << endl;
    is >> rhs._pt2;
    return is;
}

istream & operator>>(istream & is,Line::Point & rhs){
    is >> rhs._x >> rhs._y;
    return is;

}
int main(int argc, char *argv[])
{
    Line::Point pt1(1,2);
    Line line(1,2,3,4);
    cout << line << endl;

    cin >> line;
    cout << line << endl;
    return 0;
}
